package com.zhentao.controller;

import com.github.pagehelper.PageInfo;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.pay.dto.OutDto;
import com.zhentao.model.pay.dto.PayDto;
import com.zhentao.model.pay.pojo.ApUserFinancialDetails;
import com.zhentao.model.pay.pojo.WithdrawRule;
import com.zhentao.model.pay.vo.FinancialVo;
import com.zhentao.model.pay.vo.PayVo;
import com.zhentao.model.social.dto.SocialDto;
import com.zhentao.service.ApUserFinancialDetailsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("api/v1/admin/pay/details")
@Api(tags = "FinancialController-资金管理")
public class FinancialController {
    @Resource
    ApUserFinancialDetailsService financialDetailsService;
    /**
     * 分红规则管理列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    @ApiOperation("分红规则管理列表")
    public ResponseResult list(@RequestBody PayDto dto){
        PageInfo<FinancialVo> list =financialDetailsService.getList(dto);
        return ResponseResult.okResult(list);
    }

    @PostMapping("/notCheckList")
    @ApiOperation("分红规则未审核管理列表")
    public ResponseResult notCheckList(@RequestBody PayDto dto){
        PageInfo<FinancialVo> list =financialDetailsService.notCheckList(dto);
        return ResponseResult.okResult(list);
    }
    @PostMapping("/outList")
    @ApiOperation("个人用户提现明细表")
    public ResponseResult outList(@RequestParam("userId") Integer userId){
        return financialDetailsService.outList(userId);
    }



    /**
     * 分红规则列表的修改
     * @param id
     * @return
     */
    @PostMapping("/del")
    @ApiOperation("分红规则列表的删除")
    public ResponseResult del(@RequestParam("id") Integer id){
        financialDetailsService.removeById(id);
        return ResponseResult.okResult("删除成功！");
    }

//    @PostMapping("/balance")
//    @ApiOperation("账户余额")
//    public ResponseResult balance(@RequestParam("userId") Integer userId){
//        return financialDetailsService.balance(userId);
//    }




    /**
     * 提现审核失败
     * @param dto
     * @return
     */
    @PostMapping("/loser")
    @ApiOperation("提现审核失败")
    public ResponseResult loser(@RequestBody OutDto dto){
        return financialDetailsService.loser(dto);
    }

    /**
     * 提现审核成功
     * @param id
     * @return
     */
    @GetMapping("/status")
    @ApiOperation("提现审核成功")
    public ResponseResult status(@Param("id") Integer id){
        return financialDetailsService.status(id);
    }
}
